package com.sky.mapper;/*
@author sun
@date 24/07/15
@project IntelliJ IDEA
*/

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {

    // 增加1
    @AutoFill(value = OperationType.INSERT)
    void insertOne(Dish dish);

    // 菜品分页查询
    Page<Dish> pageQuery(DishPageQueryDTO dishPageQueryDTO);

    // 根据id查询菜品
    @Select("select * from dish where id = #{id}")
    Dish getById(Long id);

    // 根据主键id删除菜品数据
    @Delete("delete from dish where id = #{id}")
    void delById(Long id);

    // 更新表中基本信息
    void updateDish(Dish dish);

    // 根据分类id查询菜品
    List<Dish> list(Dish dish);

    // 菜品起售停售
    @AutoFill(value = OperationType.UPDATE )
    void update(Dish dish);

    @Select("select * from setmeal where id = #{id}")
    List<Dish> getSetmealById(Long id);
}
